<?php session_start(); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Edit Reservation</title>
<script type="text/javascript" src="validateInformation.js" ></script>
<link href="style.css" rel="stylesheet" type="text/css" />
<?php

require_once 'UpdateManager.php';
if(isset($_POST['Done']))
{
	
	$snum = $_SESSION['snum'];
	$ornum=$_POST['orNumber'];
	$date=$_POST['dateReserved'].$_POST['bdMonth'].$_POST['bdYear'];
	$amt=$_POST['amtReserved'];
	$term=$_POST['sem'];
	$remarks=$_POST['remarksReservation'];
	$kdate=$_POST['keyDate'].$_POST['kMonth'].$_POST['kYear'];
	$kamount=$_POST['keyAmt'];
	$kremarks=$_POST['remarksKey'];

	$f = UpdateManager::updateReservation($snum,$ornum,$date,$amt,$term,$remarks,$kdate,$kamount,$kremarks);
	if($f){
		UpdateManager::showMessage($f);
	}else{
		UpdateManager::showMessage(0);
	}
}

?>

</head>


<body>

<table width="100%" border="0" cellpadding="1">

 
  <tr>
    <td>&nbsp;</td>
    <td class="subBanner"><strong> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Edit Reservation Information</strong></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>
 <form id="form1" name="form1" method="post" action="" onsubmit="return validateInformation5(this)">
      <table width="100%" border="0" cellpadding="1">
        <tr>
          <td width="37%"><strong>Official Receipt Number</strong></td>
          <td width="34%"><input name="orNumber" type="text" id="orNumber" size="40" value="<?php echo $_SESSION['ornum'] ?>"/>            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
          <td width="29%" id="ornum" class="error">&nbsp;</td>
        </tr>
        <tr>
		
		
		 <?php
			$dd=substr($_SESSION['datereserved'],0,2);			
			$mm=substr($_SESSION['datereserved'],2,3);
			$yy=substr($_SESSION['datereserved'],5,4);
		  ?>
		
          <td>Date</td>
          <td><select name="bdMonth" id="bdMonth">
			  <option value="JAN" <?php if($mm=='JAN')echo "selected='selected'"?>>January</option>
              <option value="FEB" <?php if($mm=='FEB')echo "selected='selected'"?>>February</option>
              <option value="MAR" <?php if($mm=='MAR')echo "selected='selected'"?>>March</option>
              <option value="APR" <?php if($mm=='APR')echo "selected='selected'"?>>April</option>
              <option value="MAY" <?php if($mm=='MAY')echo "selected='selected'"?>>May</option>
              <option value="JUN" <?php if($mm=='JUN')echo "selected='selected'"?>>June</option>
              <option value="JUL" <?php if($mm=='JUL')echo "selected='selected'"?>>July</option>
              <option value="AUG" <?php if($mm=='AUG')echo "selected='selected'"?>>August</option>
              <option value="SEP" <?php if($mm=='SEP')echo "selected='selected'"?>>September</option>
              <option value="OCT" <?php if($mm=='OCT')echo "selected='selected'"?>>October</option>
              <option value="NOV" <?php if($mm=='NOV')echo "selected='selected'"?>>November</option>
              <option value="DEC" <?php if($mm=='DEC')echo "selected='selected'"?>>December</option>
          </select>
&nbsp;

<input name="dateReserved" type="text" id="dateReserved" size="3"  value="<?php echo $dd;?>" />
&nbsp;
<label for="bdYear"></label>
<select name="bdYear" id="bdYear">
 
 <?php
$ys=1985;
$ye=2011;

for(;$ys <= $ye; $ys++)
{
	echo "<option value='1985'"; if($yy==$ys)echo "selected='selected'"; echo ">" . $ys . "</option>";
}
?>
 
</select>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
          <td id="rdate" class="error">&nbsp;</td>
        </tr>
        <tr>
          <td>Amount (in PhP)</td>
          <td><input name="amtReserved" type="text" id="amtReserved" size="40" value="<?php echo $_SESSION['amount']?>"/>            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
          <td id="amt" class="error">&nbsp;</td>
        </tr>
        <tr>
          <td>Term</td>
          <td><input type="radio" name="sem" id="term" value="first" <?php if($_SESSION['term']=="FIRST")echo "checked='checked'"?>/>
            1st            Semester
            <input type="radio" name="sem" id="term2" value="second" <?php if($_SESSION['term']=="SECOND")echo "checked='checked'"?>/>
            2nd Semester
            <input type="radio" name="sem" id="term3" value="summer" <?php if($_SESSION['term']=="SUMMER")echo "checked='checked'"?>/>            
            Summer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>Remarks</td>
          <td><textarea name="remarksReservation" cols=35 rows=4><?php echo $_SESSION['remarks']?></textarea>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        </table>
    </td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>

  <tr>
    <td>&nbsp;</td>
    <td class="subBanner"><strong> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Edit Key Information</strong></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td id="form1">
   
      <table width="100%" border="0" cellpadding="1">
        <tr>
		 <?php
			$dd=substr($_SESSION['datereceived'],0,2);			
			$mm=substr($_SESSION['datereceived'],2,3);
			$yy=substr($_SESSION['datereceived'],5,4);
		  ?>
          <td width="37%">Date Received</td>
          <td width="34%"><select name="kMonth" id="kMonth">
			  <option value="JAN" <?php if($mm=='JAN')echo "selected='selected'"?>>January</option>
              <option value="FEB" <?php if($mm=='FEB')echo "selected='selected'"?>>February</option>
              <option value="MAR" <?php if($mm=='MAR')echo "selected='selected'"?>>March</option>
              <option value="APR" <?php if($mm=='APR')echo "selected='selected'"?>>April</option>
              <option value="MAY" <?php if($mm=='MAY')echo "selected='selected'"?>>May</option>
              <option value="JUN" <?php if($mm=='JUN')echo "selected='selected'"?>>June</option>
              <option value="JUL" <?php if($mm=='JUL')echo "selected='selected'"?>>July</option>
              <option value="AUG" <?php if($mm=='AUG')echo "selected='selected'"?>>August</option>
              <option value="SEP" <?php if($mm=='SEP')echo "selected='selected'"?>>September</option>
              <option value="OCT" <?php if($mm=='OCT')echo "selected='selected'"?>>October</option>
              <option value="NOV" <?php if($mm=='NOV')echo "selected='selected'"?>>November</option>
              <option value="DEC" <?php if($mm=='DEC')echo "selected='selected'"?>>December</option>
            </select>
            &nbsp;

            <input name="keyDate" type="text" id="keyDate" size="3" value="<?php echo $dd;?>"/>
            &nbsp;
            <label for="kYear"></label>
            <select name="kYear" id="bdYear">
				<?php
				$ys=1985;
				$ye=2011;

				for(;$ys <= $ye; $ys++)
				{
					echo "<option value='1985'"; if($yy==$ys)echo "selected='selected'"; echo ">" . $ys . "</option>";
				}
				?>			
              </select>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
          <td width="29%" class="error" id="kdate">&nbsp;</td>
        </tr>
        <tr>
          <td>Amount</td>
          <td><input name="keyAmt" type="text" id="keyAmt" size="40" value="<?php echo $_SESSION['kamount']?>"/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
          <td id="kamt" class="error">&nbsp;</td>
        </tr>
        <tr>
          <td>Remarks</td>
          <td><textarea name="remarksKey" cols=35 rows=4><?php echo $_SESSION['kremarks']?></textarea>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
          <td >&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><input type="submit" name="Done" id="Done" value="Done" /></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td></td>
          <td>&nbsp;</td>
        </tr>
        </table>
    </td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</form> 
</table>


</body>
</html>